package com.ywk.base.concurrency.thread.createWay;

import lombok.SneakyThrows;

/**
 * 线程创建方式1:继承Thread类
 * @Author zbh
 * @Date 2024/1/2
 */
public class ThreadTest extends Thread{
    public static void main(String[] args) {
        ThreadTest t = new ThreadTest();
        t.start();//启动线程
        System.out.println("当前线程："+Thread.currentThread().getName());//获取的是主线程
    }

    @SneakyThrows
    @Override
    public void run() {
        System.out.println("当前线程："+Thread.currentThread().getName());//获取的是新建的线程
        Thread.sleep(3000);
        System.out.println("T1");
    }
}
